#include<iostream>
#include<set>
#include<vector>
using namespace std;


int main(){
	int n,k;
	cin>>n>>k;
	set<int>uniqueNums;

	for(int i=0;i<n;i++){
	    int num;
    	cin>>num;
		uniqueNums.insert(num); 
	}
	
	int count=0;
	for(auto num:uniqueNums){
		if(count>=k)break;
		cout<<num<<" ";
		count++;
	}
	cout<<endl;

	return 0;
}